﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.DataVisualization.Charting;
using System.Data;

namespace GroundWater.waterlevel
{
    public partial class chartpage : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                AddSeries(Chart2);

                GenerateImage(Chart3);
            }

            //Chart1.Series["Series1"]["DrawingStyle"] = "Cylinder";

        }

        private void AddSeries(Chart chart)
        {
            Series series = new Series("Spline");
            series.ChartType = SeriesChartType.Spline;
            series.BorderWidth = 3;
            series.ShadowOffset = 2;

            // Populate new series with data
            series.Points.AddY(67);
            series.Points.AddY(57);
            series.Points.AddY(83);
            series.Points.AddY(23);
            series.Points.AddY(70);
            series.Points.AddY(60);
            series.Points.AddY(90);
            series.Points.AddY(20);

            // Add series into the chart's series collection
            chart.Series.Add(series);

        }

        private void GenerateImage(Chart chart)
        {
            chart.Series["Series1"].ChartType = SeriesChartType.Column;
            chart.Series["Series1"]["DrawingStyle"] = "Emboss";
            //chart.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = true;
            chart.Series["Series1"].IsValueShownAsLabel = true;

            ProductsDataObject products = new ProductsDataObject();
            DataView view = products.Select();
            view.RowFilter = "ProductID < 10";

            chart.DataSource = view;
            chart.Series["Series1"].XValueMember = "ProductID";
            chart.Series["Series1"].YValueMembers = "UnitsInStock";
            chart.DataBind();
        }
    }
}
